package sopraim.presenter.validate;


public class ConnectionForm {
    
    
    public ConnectionForm(String username, String passwd) throws Exception
    {
        validateUsername(username);
        validatePassword(passwd);
        
    }
    
    private void validateUsername(String username) throws Exception
    {
        if(username == null) 
            throw(new Exception("Error : username is empty"));
        if (username.trim().isEmpty())
            throw(new Exception("Error : username is only composed of space"));
    }
    
    private void validatePassword(String password) throws Exception
    {
        if(password == null) 
            throw(new Exception("Error : password is empty"));
        if (password.trim().isEmpty())
            throw(new Exception("Error : password is only composed of space"));
    }
    
    
    
}